package com.example.demo;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Bean;

@EnableRedisHttpSession 
@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
@MapperScan("com.example.demo.mapper")  //扫mapper所在包
@ComponentScan({"com.example.demo.*"})
public class App1Application {
	@Value("${server.port}")
	String port;
	
	@Autowired
	private RestTemplate restTemplate;
	
	public static void main(String[] args) {
		SpringApplication.run(App1Application.class, args);
	}
//	@RequestMapping(value = "hi")
//	public String hi(@RequestParam(value = "name",defaultValue = "tom") String name) {
//		System.out.println(port);
//		return "你好，我是订单服务"+name+","+port;
//		
//	}
	/*
	 * @RequestMapping("/create_order") public String createOder() {
	 * System.out.println("创建订单正在被调用"); return }
	 */
	
	@Bean
	public RestTemplate getRestTemplate(){
		return new RestTemplate();
	}

}
